<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cmn-Hans">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="ThemeBucket">
        <link rel="shortcut icon" href="#" type="image/png">

        <title>系统管理</title>

        <!--引入动态CSS-->
        <?php if(is_array($header["css"])): foreach($header["css"] as $key=>$css): ?><link href="/Public/csf/<?php echo ($theme); ?>/<?php echo ($css); ?>" rel="stylesheet"><?php endforeach; endif; ?>

        <!--引入公用CSS-->
        <link href="/Public/csf/<?php echo ($theme); ?>/css/style.css" rel="stylesheet">
        <link href="/Public/csf/<?php echo ($theme); ?>/css/style-responsive.css" rel="stylesheet">
        <link href="/Public/csf/<?php echo ($theme); ?>/css/jquery-ui-1.8.16.custom.css" rel="stylesheet">

        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
        <script src="/Public/csf/<?php echo ($theme); ?>/js/html5shiv.js"></script>
        <script src="/Public/csf/<?php echo ($theme); ?>/js/respond.min.js"></script>
        <![endif]-->
        <script src="/Public/csf/<?php echo ($theme); ?>/js/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src=" /Public/csf/<?php echo ($theme); ?>/ueditor/ueditor.config.js"></script>
        <script type="text/javascript" src="/Public/csf/<?php echo ($theme); ?>/ueditor/ueditor.all.js"></script>
        <link rel="stylesheet" type="text/css" href="/Public/csf/<?php echo ($theme); ?>/webupload/webuploader.css">
        <script type="text/javascript" src="/Public/csf/<?php echo ($theme); ?>/webupload/webuploader.js"></script>
    </head>
    <body class="sticky-header">
        <!-- left side start-->
    <div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <div class="logo">
            <a href="index.html"><img src="/Public/csf/<?php echo ($theme); ?>/images/logo.png" alt=""></a>
        </div>
        <div class="logo-icon text-center">
            <a href="index.html"><img src="/Public/csf/<?php echo ($theme); ?>/images/logo_icon.png" alt=""></a>
        </div>
        <!--logo and iconic logo end-->


        <div class="left-side-inner">

            <!-- visible to small devices only -->
            <div class="visible-xs hidden-sm hidden-md hidden-lg">
                <div class="media logged-user">
                    <img alt="" src="/Public/csf/<?php echo ($theme); ?>/images/photos/user-avatar.png" class="media-object">
                    <div class="media-body">
                        <h4><a href="#">Eden</a></h4>
                        <span>"Hello There..."</span>
                    </div>
                </div>

                <h5 class="left-nav-title">Account Information</h5>
                <ul class="nav nav-pills nav-stacked custom-nav">
                    <li><a href="#"><i class="fa fa-user"></i> <span>简况</span></a></li>
                    <li><a href="#"><i class="fa fa-cog"></i> <span>系统设置</span></a></li>
                    <li><a href="#"><i class="fa fa-sign-out"></i> <span>退出</span></a></li>
                </ul>
            </div>

            <!--sidebar nav start-->
            <ul class="nav nav-pills nav-stacked custom-nav">
                <?php if(is_array($menuList)): foreach($menuList as $key=>$menu): if(in_array(strtoupper($menu['url']),$displayNodes)): if(empty($menu["sub"])): ?><li><a href="<?php echo U($menu['url']); ?>"><i class="fa <?php echo ($menu["icon"]); ?>"></i> <span><?php echo ($menu["name"]); ?></span>
                        <?php else: ?>
                            <?php if($AM == $menu['url']): ?><li class="menu-list nav-active"><a href=""><i class="fa <?php echo ($menu["icon"]); ?>"></i> <span><?php echo ($menu["name"]); ?></span></a>
                            <?php else: ?>
                            <li class="menu-list"><a href=""><i class="fa <?php echo ($menu["icon"]); ?>"></i> <span><?php echo ($menu["name"]); ?></span></a><?php endif; ?>
                                <ul class="sub-menu-list">
                                <?php if(is_array($menu["sub"])): foreach($menu["sub"] as $key=>$subMenu): if(in_array(strtoupper($subMenu['url']),$displayNodes)): ?><li ><a href="<?php echo U($subMenu['url']); ?>"> <?php echo ($subMenu["name"]); ?></a></li><?php endif; endforeach; endif; ?>
                                </ul>
                            </li><?php endif; endif; endforeach; endif; ?>
            </ul>
            <!--sidebar nav end-->

        </div>
    </div>
    <!-- left side end-->
    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <div class="header-section">

            <!--toggle button start-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->

            <!--search start-->
            <form class="searchform" action="index.html" method="post">
                <input type="text" class="form-control" name="keyword" placeholder="Search here..." />
            </form>
            <!--search end-->
            <!--notification menu start -->
            <div class="menu-right">
                <ul class="notification-menu">
                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <img src="/Public/csf/<?php echo ($theme); ?>/images/photos/user-avatar.png" alt="" />
                            Eden
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-usermenu pull-right">
                            <li><a href="#"><i class="fa fa-user"></i>  简况</a></li>
                            <li><a href="#"><i class="fa fa-cog"></i>  系统设置</a></li>
                            <li><a href="<?php echo ($logOut); ?>"><i class="fa fa-sign-out"></i> 退出</a></li>
                        </ul>
                    </li>

                </ul>
            </div>
            <!--notification menu end -->

        </div>
        <!-- header section end-->
    <!-- page heading start-->
    <div class="page-heading">
        <h3>
            <?php echo ($breadcrumb["A"]); ?>
        </h3>
        <ul class="breadcrumb">
            <li>
                <?php echo ($breadcrumb["M"]); ?>
            </li>
            <li>
                <?php echo ($breadcrumb["C"]); ?>
            </li>
            <li class="active"> <?php echo ($breadcrumb["A"]); ?>  </li>
        </ul>
    </div>
    <!-- page heading end-->
    <!-- 添加商品 -->
    <div class="wrapper">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <form role="form" action="<?php echo ($action); ?>" method="post">
                        <header class="panel-heading">
                            添加商品
                        </header>
                        <div class="panel-body">
                            <div class="form-group">
                                <label for="com_name">商品名称</label>
                                <input type="hidden" name="id" value="<?php echo ($userInfo["id"]); ?>">
                                <input type="text" name="com_name" value="<?php echo ($userInfo["com_name"]); ?>" class="form-control" id="com_name" placeholder="输入商品名称">
                            </div>
                            <div class="form-group">
                                <label for="cate_name">商品分类</label>
                               <!--  <input type="text" name="cate_name[]" class="form-control" id="cate_name" placeholder="选择商品分类"> -->
                                <select  class="form-control" name="cate_name[]" id="pid" multiple="multiple" size="5">
                                    <!-- <option value="0">顶级分类</option> -->
                                    <?php echo ($getCategoryStr); ?>
                                </select>
                            </div>

                            <div class="form-group">
                                <label for="com_number">商品货号</label>
                                <input type="text" name="com_number" value="<?php echo ($userInfo["com_number"]); ?>" class="form-control" placeholder="输入商品货号">
                            </div>
                            <div class="form-group">
                                <label for="com_keywords">商品关键词</label>
                                <input type="text" name="com_keywords" value="<?php echo ($userInfo["com_keywords"]); ?>" class="form-control" placeholder="输入关键词">
                            </div>
                            <div class="form-group">
                                <label for="com_discription">商品描述</label>
                                <input type="text" name="com_discription" value="<?php echo ($userInfo["com_discription"]); ?>"  class="form-control"  placeholder="输入商品描述">
                            </div>
                            <div class="form-group">
                                <label for="com_store">商品库存</label>
                                <input type="text" name="com_store" value="<?php echo ($userInfo["com_store"]); ?>" class="form-control"  placeholder="输入库存量">
                            </div>
                            <div class="form-group">
                                <label for="com_price">商品价格</label>
                                <input type="text" name="com_price" value="<?php echo ($userInfo["com_price"]); ?>" class="form-control"  placeholder="输入商品价格">
                            </div>
                            <div class="form-group">
                                <label for="com_price">商品图片</label>
                                <div class="col-md-12">
                                    <!-- <div class="col-md-2" style="padding-left: 20px;font-size: 18px;height: 25px;line-height: 25px;color: black;"><span class="glyphicon glyphicon-th-list"></span>  幻灯片设置</div> -->
                                        <div class="col-md-12">&nbsp;</div>
                                        <div class="form-group">
                                            <div class="row">
                                                <div id="picker" class="col-md-2">上&nbsp;&nbsp;&nbsp;&nbsp;传</div>
                                            </div>
                                            <input type="hidden" id="sitelogo" name="sitelogo" placeholder="网站LOGO">
                                        </div>
                                </div>
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th class="text-center">图片</th>
                                            <th class="text-center">关键词描述</th>
                                            <th class="text-center">链接</th>
                                            <th class="text-center">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody id="picBox">
                                        <?php if ($comimg) { ?>
                                            <?php foreach ($comimg as $key => $value) { ?>
                                                <tr id="lineh">
                                                    <td><img src="/Public/upload/<?php echo ($theme); ?>/<?php echo $value['com_img_name']; ?>" style="width: 100px;height: 100px;"><input type="hidden" name="banner[]" value="<?php echo $value['banner']; ?>"></td>
                                                    <td><input type="text" name="keywords[]" value="<?php echo $value['com_img_keyword']; ?>"></td>

                                                    <td><input type="text" name="link[]" value="<?php echo $value['com_img_link']; ?>"></td>
                                                    <td><a href="#" class="delbtn btn btn-danger"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span>　删除</a></td>
                                                </tr>
                                            <?php } ?>
                                        <?php } ?>
                                    </tbody>
                                </table>
                            </div>
                            
                             <div class="form-group">
                                <label for="com_details">商品详情</label>
                                <!-- <input type="text" name="com_details" class="form-control" id="sort" placeholder="输入商品详情"> -->
                                <textarea name="com_details" required="true" id="content" placeholder="输入商品详情"><?php echo ($userInfo["com_details"]); ?></textarea>
                            </div>
                                                   
                            <div class="form-group">
                                <label for="status">状态</label>
                                <select class="form-control m-bot15" id="status" name="status">
                                    <option value="1">启用</option>
                                    <option value="0">禁用</option>
                                </select>
                            </div>
                        </div>
                        <div>&nbsp;</div>
                        <div class="panel-body">
                            
                            <button type="submit" class="btn btn-primary">保存</button>
                            <a href="<?php echo ($cancel); ?>" class="btn btn-primary">取消</a>
                        </div>
                    </form>
                </section>
            </div>
        </div>
    </div>
    <!-- 编辑器 -->
    <script type="text/javascript">
         var ue = UE.getEditor('content',{
            initialFrameWidth:1120,
            initialFrameHeight:400,
            autoHeightEnabled:false,
        });
    </script>
    <!-- 引入上传文件工具 -->
    <script type="text/javascript">
        var uploader = WebUploader.create({
            // 选完文件后，是否自动上传。
            auto: true,
            // swf文件路径
            swf: '/Public/csf/<?php echo ($theme); ?>/webupload/Uploader.swf',
            // 文件接收服务端。
            server: '/Public/csf/<?php echo ($theme); ?>/webupload/upfile.php',
            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '#picker',
            // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
            resize: false,

            runtimeOrder:false,
            //允许重复上传
            duplicate:true,
            // 只允许选择图片文件。
            accept: {
                title: 'Images',
                extensions: 'gif,jpg,jpeg,bmp,png',
                mimeTypes: 'image/jpg,image/jpeg,image/png',
            }
        });
        //添加到上传队列事件
        uploader.on( 'fileQueued', function( file ) {
            
        });
        //上传成功事件
        uploader.on( 'uploadSuccess', function(file,response) {
            if(response._raw!='000'){
                // $('#sitelogo').val(response._raw);
                var $tr = $(
                    '<tr><td class="text-center" id="' + file.id + '">' +
                        '<img>' +
                        '<input id="' + file.id + 'img" type="hidden" name="banner[]" value="' +response._raw+ '"></td><td class="text-center"><input type="text" name="keywords[]"></td><td class="text-center"><input type="text" name="link[]"></td><td><a href="#" class="delbtn btn btn-danger">删除</a></td>' +
                    '</tr>'
                    ),
                    $img = $tr.find('img');
                    $('#picBox').append( $tr );
                    uploader.makeThumb( file, function( error, src ) {
                        if ( error ) {
                            $img.replaceWith('<span>不能预览</span>');
                            return;
                        }

                        $img.attr( 'src', src );
                    }, 100, 100 );
            }
            
        });
        //上传失败事件
        uploader.on( 'uploadError', function( file ) {
            var $li = $( '#'+file.id ),
                $error = $li.find('div.error');

            // 避免重复创建
            if ( !$error.length ) {
                $error = $('<div class="error"></div>').appendTo( $li );
            }

            $error.text('上传失败');
        });
    </script>
    <!-- 绑定删除按钮 -->
    <script type="text/javascript">
                $('#picBox').on('click','.delbtn',function(){
                    $(this).parent().parent().remove();
                    return false;
                });
    </script>
    <!-- page footer start-->
    
    <!-- Placed js at the end of the document so the pages load faster -->
    <script src="/Public/csf/<?php echo ($theme); ?>/js/jquery-ui-1.9.2.custom.min.js"></script>
    <script src="/Public/csf/<?php echo ($theme); ?>/js/jquery-migrate-1.2.1.min.js"></script>
    <script src="/Public/csf/<?php echo ($theme); ?>/js/bootstrap.min.js"></script>
    <script src="/Public/csf/<?php echo ($theme); ?>/js/modernizr.min.js"></script>
    <script src="/Public/csf/<?php echo ($theme); ?>/js/jquery.nicescroll.js"></script>

    <!--动态插入JS-->
    <?php if(is_array($footer["js"])): foreach($footer["js"] as $key=>$script): ?><script src="/Public/csf/<?php echo ($theme); ?>/<?php echo ($script); ?>"></script><?php endforeach; endif; ?>
    <script src="/Public/csf/<?php echo ($theme); ?>/js/fm.js"></script>
    <!--common scripts for all pages-->
    <script src="/Public/csf/<?php echo ($theme); ?>/js/scripts.js"></script>

</script>
    </body>
</html>